{% extends "forum/forumbase.html" %}

{% comment %}
#    Copyright 2012 New Mexico EPSCoR
#
#    This file is part of Teacher's P.E.T.
#
#    Teacher's P.E.T. is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Teacher's P.E.T. is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with Teacher's P.E.T..  If not, see <http://www.gnu.org/licenses/>.
{% endcomment %}

{% load files %}

{% block title %} Attach file | {{TheMessage.subject}} | {{block.super}}{% endblock title %}

{% block css %}
    {{block.super}}
    <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/forum.css" >
{% endblock css %}

{% block content %}
<div class="forum-send-message">
	<div class="forum-send-message-attach-title">
		<h1>Attach Files</h1>
	</div>
	
	<table class="forum-message-attach-table" cellpadding=0 cellspacing=0 border=0>
		<tr>
			<td colspan="100%" class="forum-message-subject">
				{{TheMessage.subject}}
			</td>
		</tr>
		<tr>
			<td class="forum-message-sender-avatar">
			{% with User=users|getitem:TheMessage.sender %}
				<img src="{% if User.avatar %}{{User.avatar}}{% else %}{{STATIC_URL}}images/BlankAvatar.png{% endif %}" height="25">
			{% endwith %}
			</td>
			<td class="forum-message-sender"><span class="forum-message-sender-info">{{TheMessage.sender_name}}</span><br><span class="forum-message-recipient">to&nbsp;{{TheMessage.recipient_name}}</span></td>
		</tr>
		<tr>
			<td></td>
			<td class="forum-message-body" colspan="100%">
				{% render TheMessage.message %}
			</td>
		</tr>
		<tr>
			<td></td>
			<td class="forum-messages-entry-files">
				{% get_file_list for TheMessage as Files %}
				<ul>
					{% for file in Files %}
						<li>
							<a href="{% course_url forum_download_message_attachment message_id=TheMessage.id filename=file.filename %}" target="_blank">
								<img src="{{STATIC_URL}}images/files/{{file.icon}}" height="25"> {{file.title}}{% if file.extension %}.{{file.extension}}{% endif %}
							</a>{% if file.description %} - {{file.description}}{% endif %}
							<a href="{% course_url forum_delete_message_attachment message_id=TheMessage.id file_id=file.id %}" class="forum-entries-button forum-messages-delete-attachment">x</a>
						</li><br>
					{% endfor %}
				</ul>
			</td>
		</tr>
	</table>
    <a href="{% course_url forum_view_message message_id=TheMessage.id %}" class="forum-entries-button">Return to Editing Message</a>
    {% get_file_form_target as target %}
        <hr>
        {% render_file_form for TheMessage %}
</div>
{% endblock content %}